import request from '@/utils/request'

export default {
  saveCourseInfo(courseInfo) {
    return request({
      url: `/admin/courses/addCourse`,
      method: 'post',
      data: courseInfo
    })
  },

  getTeacherList() {
    return request({
      url: `/admin/courses/findAll`,
      method: 'get'
    })
  },
  getCourseInfo(courseId) {
    return request({
      url: `/admin/courses/getCourseInfo/${courseId}`,
      method: 'get'
    })
  },
  updateCourseInfo(courseInfo) {
    return request({
      url: `/admin/courses/updateCourseInfo`,
      method: 'put',
      data: courseInfo
    })
  },
  //根据课程id查询课程发布的基本信息
  getPublishCourseInfo(id) {
    return request({
      url: `/admin/courses/getPublishCourseInfo/${id}`,
      method: 'get'
    })
  },
  //发布课程信息
  publishCourse(id) {
    return request({
      url: `/admin/courses/publishCourse/${id}`,
      method: 'put'
    })
  },
  //删除课程
  removeCourse(id) {
    return request({
      url: `/admin/courses/deleteCourse/${id}`,
      method: 'delete'
    })
  },
  //分页查询课程
  pageQuery(current, size, courseQuery) {
    return request({
      url: `/admin/courses/pageQuery/${current}/${size}`,
      method: 'post',
      data: courseQuery
    })
  }
}
